<#assign classDesc = "业务实现类">
<#include "/java_copyright.include">
package ${serviceimpl};

import ${basepackage}.core.dao.IMapper;
import ${basepackage}.core.service.BaseServiceSupport;
import ${basepackage}.core.service.ServiceException;
import ${basepackage}.core.vo.ResultCode;
import ${basepackage}.core.vo.inf.IResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ${mapper}.I${className}Mapper;
import ${iservice}.I${className}Service;
import ${vo}.${className};

<#include "/java_comments.include">
@Service("${classNameLower}Service")
public class ${className}Service extends BaseServiceSupport<${className}> implements I${className}Service{
    //${table.functionName}Mapper
    @Autowired
    private I${className}Mapper ${classNameLower}Mapper;

    @Override
    public IMapper getMapper() {
        return ${classNameLower}Mapper;
    }

    @Override
    public IResult save(${className} entity) {
        try {
            ${classNameLower}Mapper.save(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("新增${table.functionName}失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult update(${className} entity) {
        try {
            ${classNameLower}Mapper.update(entity);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("修改${table.functionName}失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult delete(Long id) {
        try {
            ${classNameLower}Mapper.delete(id);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }

    @Override
    public IResult deleteByIds(String ids) {
        try {
            ${classNameLower}Mapper.deleteByIds(ids);
            return ResultCode.SUCCESS;
        } catch (Exception e) {
            log.error("删除失败", e);
            throw new ServiceException(ResultCode.ERROR);
        }
    }
}